@page
@model B.WMS.Web.Pages.Inventory.DetailModel
@{
    ViewData["Title"] = "盘点明细";
}

<div class="container-fluid">
    <!-- 操作按钮区域 -->
    <div class="card mb-3">
        <div class="card-body">
            <button type="button" class="btn btn-primary" onclick="refreshData()">
                <i class="fas fa-sync"></i> 刷新
            </button>
        </div>
    </div>

    <!-- 数据表格区域 -->
    <div class="card">
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-striped table-hover" id="detailTable">
                    <thead>
                        <tr>
                            <th>盘盈数量</th>
                            <th>盘亏数量</th>
                            <th>盘盈金额</th>
                            <th>盘亏金额</th>
                            <th>经办人</th>
                            <th>制单人</th>
                            <th>所在部门</th>
                            <th>制单时间</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody id="detailTableBody">
                        <!-- 数据将通过JavaScript动态加载 -->
                    </tbody>
                </table>
            </div>

            <!-- 分页区域 -->
            <div class="d-flex justify-content-between align-items-center mt-3">
                <div>
                    总 <span id="totalCount">0</span> 条
                </div>
                <div class="d-flex align-items-center">
                    <button class="btn btn-sm btn-outline-primary" onclick="previousPage()">&lt;</button>
                    <div class="mx-2" id="pageNumbers">
                        <!-- 页码将通过JavaScript动态生成 -->
                    </div>
                    <button class="btn btn-sm btn-outline-primary" onclick="nextPage()">&gt;</button>
                    <select class="form-control form-control-sm ml-2" id="pageSize" onchange="changePageSize()">
                        <option value="10">10条/页</option>
                        <option value="20">20条/页</option>
                        <option value="50">50条/页</option>
                    </select>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 编辑明细模态框 -->
<div class="modal fade" id="detailModal" tabindex="-1" role="dialog">
    <div class="modal-dialog modal-lg" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <h5 class="modal-title" id="modalTitle">编辑明细</h5>
                <button type="button" class="close" data-dismiss="modal">
                    <span>&times;</span>
                </button>
            </div>
            <div class="modal-body">
                <form id="detailForm">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>货品名称</label>
                                <input type="text" class="form-control" id="modalGoodsName" readonly>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>货品编号</label>
                                <input type="text" class="form-control" id="modalGoodsCode" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>账面数量</label>
                                <input type="number" class="form-control" id="modalRqty" readonly>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>账面金额</label>
                                <input type="number" class="form-control" id="modalRamout" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>盘点数量 <span class="text-danger">*</span></label>
                                <input type="number" class="form-control" id="modalPqty" required>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>盘点单位</label>
                                <input type="text" class="form-control" id="modalUnit" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>盈亏数量</label>
                                <input type="number" class="form-control" id="modalDqty" readonly>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label>盈亏金额</label>
                                <input type="number" class="form-control" id="modalDamount" readonly>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label>货品备注</label>
                        <textarea class="form-control" id="modalDremark" rows="3" placeholder="请输入"></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" onclick="saveDetail()">保存</button>
            </div>
        </div>
    </div>
</div>

@section Scripts {
    <script src="~/Pages/Inventory/Detail.js"></script>
} 